using Plots
using LinearAlgebra
X = [
   -0.074   1.611;
0.109   0.518;
-0.409  -0.768;
0.403   1.099;
-1.823  1.338;
0.243   -0.76;
-0.019  1.758;
0.186   0.239;
-19.45  -2.623;
-1.064  1.169;
-0.167  -1.403;
-1.539  0.776;
0.544   -2.012;
-1.618  0.932;
-16.217 2.045;
-0.209  1.04;
-0.838  0.328;
-0.212  -2.112;
0.63    -0.486;
-0.737  0.234;
-0.658  0.044;
0.541   0.021;
10.21   11.74;
-0.256  -1.17;
-0.315  -1.008;
-1.236  0.788;
0.158   -0.242;
-22.356 -19.31;
-0.824  -0.651;
-0.368  0.166;
-0.284  0.925;
0.024   0.145;
-0.291  -0.584;
-0.997  1.068;
0.109   -1.315;
1.06    -0.76;
-0.633  -1.025;
-1.112  -1.013;
1.118   -0.276
];
function ellipse_draw(A,b) #; p=nothing, label="")
   t = collect(LinRange(0, 2*pi, 100))
   x = sin.(t)
   y = cos.(t)
   Y = hcat(x,y)
   F = eigen(A'*A)
   s = F.values
   V = F.vectors    
   X_ell = V*diagm(s .^(-.5))*Y'
   X_ell = X_ell .- (inv(A)*b)
   return X_ell[1,:], X_ell[2,:]
end